package com.gsoe.auth.utils;

import cn.dev33.satoken.secure.SaSecureUtil;

public class PasswordUtils {
    private static final String s="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALYLE498gD+fA1v5dHdf0hNL03DB6VVvVIuvL9wYmhgfpcW5DXxP3yQe3aWu2nTjx3eH1FPTUaA3oSfWiok5QrFEztjkpR9R0sHHdaiwLct3t882PpUVJTzAz73lzbHcaCmrI9tmiLFPtCfTk4PdwkfKsugWreNIIo6tzbNaOZnJAgMBAAECgYAA1RRuxBG2pY46ufo2ZbdPupMtEVuBz77AXcAKnruTosKboK2gwbrvAhiFPnZ5JHJ5lJYoscJn7y37ARmq9Q23c+cUU/4zOrKEgQXrU209BZ79/cQUvkbj7XJIjHIHYxUETdkrLlLUoVnEJLUatVtu6gcs+F48TdsbANN7C4Z4lQJBANC9fmt4Dvdnt8FOAo+TQNkqqsZJ5VP8HNu4kRUl8jymHz6j25wH+u3Sa976aWlTvSy31WkJro0nckZASd3bC30CQQDfQjzPGPfWCtcoGDqn9cj6NXo/dBocoXQD1kr9sp0OmqAL++UOoDDzuAxI9xDrUaWas0Seg87Q7dF+2L702+E9AkEAuzzew0OkGSQ93fU9ss/hYWs2WDs8rAL/V8/Mw+2Pxfs1F5kfimxWFzGidRalq0bj79LOaTO4EQGLLZzJJWoweQJACegKgrX86UZ53ZGVqLZDQLb2wbIJJpQTbcgoc7FlPqylxWJb+5YoFehowyQTYB2zV3X06YO3vZWP4i0D7CGFkQJAZArKapCahG3QHYhZ5Zzn7ZwY8/9oVxI9NmRFkYmyz9SBXv2T5x8bM2bPakREP+VXyjuQW9zg90g23QbE/bw7sw==";
    private static final String s2="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2CxOPfIA/nwNb+XR3X9ITS9NwwelVb1SLry/cGJoYH6XFuQ18T98kHt2lrtp048d3h9RT01GgN6En1oqJOUKxRM7Y5KUfUdLBx3WosC3Ld7fPNj6VFSU8wM+95c2x3GgpqyPbZoixT7Qn05OD3cJHyrLoFq3jSCKOrc2zWjmZyQIDAQAB";

    public static String encrypt(String password) {
        return SaSecureUtil.rsaEncryptByPublic(s2, password);
    }

    public static boolean decryptAndCheck(String input,String passwordWithEncrypt) {
        String get = SaSecureUtil.rsaDecryptByPrivate(s, passwordWithEncrypt);
        return get.equals(input);

    }
}
